import { createSSRApp } from 'vue'
import App from './App.vue'

import { createPinia } from 'pinia'
// pinia 持久化存储插件
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'

export function createApp () {
  // app 应用实例
  const app = createSSRApp(App)

  // 创建 pinia 实例
  const pinia = createPinia()
  // 为 pinia 添加持久化存储插件
  pinia.use(piniaPluginPersistedstate)
  // 为 app 添加pinia
  app.use(pinia)

  return {
    app
  }
}
